package com.s63.springboot3.entity;

import lombok.Data;

@Data
public class AjaxResult {
    private int code = 200;
    private String msg = "success";
    private Object data;

    public static AjaxResult ok() {
        return new AjaxResult();
    }

    public static AjaxResult ok(Object data) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setData(data);
        return ajaxResult;
    }

    public static AjaxResult err() {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setCode(500);
        return ajaxResult;
    }

    public static AjaxResult err(String msg) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.setCode(500);
        ajaxResult.setMsg(msg);
        return ajaxResult;
    }
}
